<?php
/**
 * @version 0.8.3 2010-10-07
 * @package Joomla
 * @subpackage LeagueResults
 * @copyright (C)  2008, 2009, 2010 Henryk Drozd
 * updates n4pool
 * @license GNU/GPL, see LICENSE.php
 * LeagueResults is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License 2
 * as published by the Free Software Foundation.

 * LeagueResults is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.model');

class lrModelSeason extends JModel
{
	var $_season = null;
	var $_id = null;
	
	function __construct()
	{
	parent::__construct();
	$id = JRequest::getVar ('id', 0);
	$this->_id = $id;
	}
	
	
	function getList()
	{
	if (!$this->_season)
		{
		
					
		$query = "SELECT DISTINCT ls.*, tc.team_id, t.name AS teamname, t.tbadge, t.club_id, c.url  
					FROM #__lr_leagueseasons AS ls
						JOIN #__lr_tableheaders AS th ON (th.leagueseasons_id = ls.id)
						JOIN #__lr_tablecontents AS tc ON ((tc.tableheaders_id = th.id))
						JOIN #__lr_teams AS t ON (tc.team_id = t.id)
						JOIN #__lr_clubs AS c ON (t.club_id = c.id)
			 		WHERE ls.id ='".$this->_id."' 
			 		AND ls.published = '1' ORDER BY t.name ASC";
									
				
		$this->_season = $this->_getList($query, 0, 0);
		}

	return $this->_season;
	}
}

?>